\chapter*{Appendice}

\section*{Grammatica EBNF per Blite}

\begin{verbatim} 

	CompilationUnit	:=	Deployments <EOF>

	Deployments	:=	Deployment ( "||" Deployment )*

	Deployment	:=	"{" Service  "}" ( CorrelationSet )?

	CorrelationSet	:=	"(" <IDENTIFIER> ( "," <IDENTIFIER> )* ")"

	Service	:=	ServiceDef | ( ServiceInstance ( "," Service )? )

	ServiceInstance	:=	"::" Activity

	ServiceDef	:=	ServiceScope

	ServiceScope	:=	"[" StartActivity ( <FH> Activity )? "]"

	Scope	:=	"[" Activity ( <FH> Activity )? ( <CH> Activity )? "]"

	StartScopeActivity :=   "["   StartActivity 
	                           ( "fh:" Activity )? 
	                           ( "ch:" Activity )? 
	                        "]"

	StartActivity := ReceiveActivity | StartSequenceActivity | 
	                 StartScopeActivity | StartFlowActivity |
	                 StartPickActivity 

	Activity :=	BasicActivity | SequenceActivity | Scope |
	            PickActivity | FlowActivity | ConditionalActivity |
	            IterationActivity

	BasicActivity := EmptyActivity | ReceiveActivity | InvokeActivity |
	                 ExitActivity | AssignActivity | ThrowActivity

	StartSequenceActivity :=   "seq" StartActivity 
	                          ( ";" ( Activity )? )* 
	                           "qes"

	SequenceActivity :=	  "seq" Activity 
	                     ( ";" ( Activity )? )* 
	                      "qes"

	StartFlowActivity :=   "flw" StartActivity 
	                      ( "|" StartActivity )+ 
	                       "wlf"

	FlowActivity :=   "flw" Activity 
	                 ( "|" Activity )+ 
	                  "wlf"

	StartPickActivity :=  "pck" ReceiveActivity ";" Activity ";" 
	                     ( "+" ReceiveActivity ";" Activity ";" )+ 
	                      "kcp"

	PickActivity :=  "pck" ReceiveActivity ";" Activity ";" 
	                ( "+" ReceiveActivity ";" Activity ";" )+ 
	                 "kcp"	

	EmptyActivity := "empty"

	ReceiveActivity := "rcv" RecPartners OperationId "(" RecParams ")"

	InvokeActivity := "inv" InvPartners OperationId "(" InvParams ")"

	ExitActivity := "exit"

	ThrowActivity := "throw"

	RecPartners	:= "<" PartnerLitId ( "," PartnerId )? ">"

	InvPartners	:= "<" PartnerId ( "," PartnerLitId )? ">"

	PartnerId := PartnerLitId | BoundId 

	PartnerLitId :=	<STRING_LITERAL>

	OperationId := <IDENTIFIER>

	RecParams := BoundId ( "," BoundId )*

	InvParams := InvParam ( "," InvParam )*

	InvParam := Expression

	AssignActivity := BoundId ":=" Expression

	VarId := <IDENTIFIER>

	BoundId	:= <IDENTIFIER>

	ConditionalActivity	:=	"if" "(" Expression ")" Activity Activity

	IterationActivity := "while" "(" Expression ")" Activity

	Expression	:=	ConditionalOrExpression

	ConditionalOrExpression := ConditionalAndExpression 
	                           ( "or" ConditionalAndExpression )*

	ConditionalAndExpression := EqualityExpression 
	                            ( "and" EqualityExpression )*

	EqualityExpression := RelationalExpression 
	                        (   "==" RelationalExpression 
                              | "!=" RelationalExpression 
	                        )*

	RelationalExpression :=	AdditiveExpression 
	                        (   "<" AdditiveExpression 
	                          | ">" AdditiveExpression 
	                          | "<=" AdditiveExpression 
	                          | ">=" AdditiveExpression 
	                        )*

	AdditiveExpression := MultiplicativeExpression 
	                        (   "+" MultiplicativeExpression 
	                          | "-" MultiplicativeExpression
	                        )*

	MultiplicativeExpression := UnaryExpression 
	                            (   "*" UnaryExpression 
	                              | "/" UnaryExpression 
	                            )*

	UnaryExpression := "!" UnaryExpression | BaseExpression

	BaseExpression :=  VarId | Literal | "(" Expression ")"

	Literal := <STRING_LITERAL> | <NUMBER_LITERAL> |  BooleanLiteral

	BooleanLiteral := <TRUELITERAL>  | <FALSELITERAL>

	/* LITERALS */

	< TRUELITERAL: "true" >
	< FALSELITERAL: "false" >

	< STRING_LITERAL:
      "\""
      (   (~["\"","\\","\n","\r"])
        | ("\\"
            ( ["n","t","b","r","f","\\","'","\""]
            | ["0"-"7"] ( ["0"-"7"] )?
            | ["0"-"3"] ["0"-"7"] ["0"-"7"]
            )
          )
      )*
      "\""
	>

	< NUMBER_LITERAL:
        (["0"-"9"])+ ( "." )? (["0"-"9"])* 
                     (<EXPONENT>)? (["f","F","d","D"])?
      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
	>

	< #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >

	/* IDENTIFIERS */

	< IDENTIFIER: <LETTER> (<PART_LETTER>)* >

	< #LETTER:
      [  
         "$",
         "A"-"Z",
         "_",
         "a"-"z"
	  ]>

	< #PART_LETTER:
      [  
         "\u0000"-"\u0008",
         "\u000e"-"\u001b",
         "$",
         "0"-"9",
         "A"-"Z",
         "_",
         "a"-"z",
	]>

\end{verbatim}